//
//  MYShopSalesOrderSucceedVC.swift
//  MuYing
//
//  Created by tbb on 2019/8/10.
//  Copyright © 2019 TBB. All rights reserved.
//

import UIKit

class MYShopSalesOrderSucceedVC: YQMYBaseViewController {
    @objc var isIntegral = false;
    @objc var paySuceedBtnText = kYQLSSwift("查看我的订单");
    @objc var paySuceedLbText = kYQLSSwift("订单支付成功");
    @objc var goBarkToVC:String?
    @IBOutlet weak var paySuceedBtn: QMUIFillButton!
    @IBOutlet weak var paySuceedLb: UILabel!
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = appTableViewBGColor;
        self.isNavShadow = true;
        self.paySuceedBtn.fillColor = UIColorFromHex(rgbValue: 0xBDE0D3);
        self.paySuceedBtn.setTitle(paySuceedBtnText, for: .normal)
        self.paySuceedLb.text = paySuceedLbText;
        
        self.paySuceedBtn.addTarget(self, action: #selector(paySuceedAction(_ :)), for: .touchUpInside);
    }
    override func leftItemAction(_ sneder: UIButton) {
        self.navigationController?.popToRootViewController(animated: true);
    }
    @objc public func paySuceedAction(_ sender: UIButton) {
        let currentStr = sender.currentTitle as String?;
        if kYQLSSwift("查看我的订单") == currentStr {
            let orderManageVC = YQOrderManageVC();
            orderManageVC.isIntegral = self.isIntegral;
            self.navigationController?.pushViewController(orderManageVC, animated: true);
        }else {
            if let goBarkToVC = self.goBarkToVC {
                
                if let arr = self.navigationController?.viewControllers,let vcClass : AnyClass = NSClassFromString(goBarkToVC) {
                    for tempVC in arr {
                        if tempVC.isKind(of: vcClass) {
                            self.navigationController?.popToViewController(tempVC, animated: true)
                        }
                    }
                }

            }else{
                self.navigationController?.popToRootViewController(animated: true);
            }
        }
        
    }

}
